{%extends "MssaeSeoBundle::layout.html.twig"%}
{%block body%}
    <h1>Projet list</h1>
{% if entities is not empty %}
    <div id="entities_table">
        <table class="records_list">
            <thead>
                <tr>
                {%if is_granted('ROLE_ADMIN')%}                
                    <th>Id</th>
                {%endif%}
                    <th>Nom</th>
                    <th>Url</th>
                    <th>Client</th>
                    <th>Commentaire</th>
                    <th>Create_at</th>
                    <th>Statut</th>
                {%if is_granted('ROLE_ADMIN')%}
                    <th>Actions</th>
                {%endif%}
                </tr>
            </thead>
            <tbody>
            {% for entity in entities %}
                <tr>
                {%if is_granted('ROLE_ADMIN')%}
                    <td><a href="{{ path('projet_show', { 'id': entity.id }) }}">{{ entity.id }}</a></td>
                {%endif%}
                    <td><a href="{{ path('projetannuaire', { 'idProject': entity.id}) }}">{{ entity.nom }}</a></td>
                    <td>{{ entity.url }}</td>
                    <td>{{ entity.client }}</td>
                    <td>{{ entity.commentaire }}</td>
                    <td>{% if entity.createat %}{{ entity.createat|date('Y-m-d H:i:s') }}{% endif %}</td>
                    <td>{{ entity.statut }}</td>
                    {%if is_granted('ROLE_ADMIN')%}
                        <td>
                            <ul>
                                <li>
                                    <a href="{{ path('projet_show', { 'id': entity.id }) }}">show</a>
                                </li>
                                <li>
                                    <a href="{{ path('projet_edit', { 'id': entity.id }) }}">edit</a>
                                </li>
                            </ul>
                        </td>                
                    {%endif%}
                </tr>
            {% endfor %}
            </tbody>
        </table>
        <div>
            {%if pager.haveToPaginate%}
                {{ pagerfanta(pager, 'default_translated', {'routeName': 'projet'}) }}                
            {%endif%}
        </div>            
    </div>
{%else%}
    <div id="entity_vide">
        <p>Aucun annuaire trouvés</p>
    </div>
{%endif%}            
{%if is_granted('ROLE_ADMIN')%}
    <ul>
        <li>
            <a href="{{ path('projet_new') }}">
                Create a new entry
            </a>
        </li>
    </ul>
{%endif%}   
{%endblock%}